package org.jprogger.myworld.api.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jprogger.myworld.api.ApiServiceInvocationException;
import org.jprogger.myworld.api.app.AppContext;
import org.jprogger.myworld.api.model.User;
import org.jprogger.myworld.api.response.ApiResponse;
import org.jprogger.myworld.api.response.handler.GetListAppFriendApiResponseHandler;
import org.jprogger.myworld.api.response.handler.GetListFriendApiResponseHandler;

public class FriendService extends BaseApiService {
	
	public FriendService(AppContext context) {
		super(context);
	}
	
	public ApiResponse<List<User>> getFriends(String userId, int extendedReq) 
			throws ApiServiceInvocationException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("ext", extendedReq);
		params.put("uid", userId);
		params.put("method", "friends.get");
		return apiCall(params, new GetListFriendApiResponseHandler());
	}
	
	public ApiResponse<List<User>> getApplicationFriends(String userId, int extendedReq)
			throws ApiServiceInvocationException {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("ext", extendedReq);
		params.put("uid", userId);
		params.put("method", "friends.getAppUsers");
		return apiCall(params, new GetListAppFriendApiResponseHandler());
	}
}
